﻿<Window 
    x:Class="frmNetworkPlanSample"
 	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ax="clr-namespace:axVisDrawCtrl;assembly=axVisDrawCtrl"
	mc:Ignorable="d"
	xmlns:Custom="http://schemas.microsoft.com/wpf/2008/toolkit" x:Name="nsWpfToolkit"
	Width="712" Height="484"
    Title="Network Plan Sample"
    Loaded="onNetworkPlanSampleFormLoaded"
    WindowStartupLocation="CenterScreen">

    <!--  add a context menu for the objects -->
    <Window.Resources >
        <!-- non shared creates a new instance everytime -->
        <ContextMenu x:Key="NonsharedInstanceContextMenu" x:Shared="False">
            <MenuItem Header="Display Product Information" Click="DisplayProductInfo_Click"/>
        </ContextMenu>
        <!-- shared is a single instance for everyone -->
        <ContextMenu x:Key="SharedInstanceContextMenu" x:Shared="True">
            <MenuItem Header="Display Product Information" Click="DisplayProductInfo_Click"/>
        </ContextMenu>

    </Window.Resources>

    <Grid x:Name="LayoutRoot" Background="White">

        <StackPanel Name="spMenus" Orientation="Horizontal" VerticalAlignment="Top" Height="25">
            <Menu Name="menuFile">
                <MenuItem Header="File" Name="hdrFile">
                    <MenuItem Header="New" Name="menuFileNew" Click="menuFileNew_Click" />
                    <MenuItem Header="Open" Name="menuFileOpen" Click="menuFileOpen_Click" />
                    <MenuItem Header="Close" Name="menuFileClose" Click="menuFileClose_Click"/>
                    <Separator/>
                    <MenuItem Header="Save" Name="menuFileSave" Click="menuFileSave_Click"/>
                    <Separator/>
                    <MenuItem Header="Print Preview" Name="menuFilePrintPreview" Click="menuFilePrintPreview_Click"/>
                    <Separator/>
                    <MenuItem Header="Exit" Name="menuFileExit" Click="menuFileExit_Click"/>
                </MenuItem>
            </Menu>
            <Menu x:Name="Help" Margin="0,0,5,0" HorizontalAlignment="Left">
                <MenuItem Header="Help">
                    <MenuItem Header="About" x:Name="menuHelpAbout" Click="menuHelpAbout_Click"/>
                </MenuItem>
            </Menu>
            <!-- end stackpanel menu -->
        </StackPanel>
    
    
        <!-- now add the visio control -->
        <WindowsFormsHost Name="wfh" Margin="12,32,340,148">
            <ax:axVisDraw Name="axVis"/>
        </WindowsFormsHost>

        <StackPanel Name="spButtons" Orientation="Horizontal" Width="300" Height="155"
                  HorizontalAlignment="Right" Margin="0,65,39,0" VerticalAlignment="Top">

            <Button x:Name="server" 
                Margin="10,20,0,0" Width="90" Height="104" 
				HorizontalAlignment="Right" VerticalAlignment="Top"
                Click="NetworkButton_Click">
                <Button.ContextMenu>
                    <ContextMenu Name="cmServer">
                        <MenuItem Name="cmmiServer" Header="Display Product Information" Click="DisplayProductInfo_Click"/>
                    </ContextMenu>
                </Button.ContextMenu>
                <Image Source="server.bmp"/>
            </Button>
            <Button x:Name="pc" 
                    Margin="10,20,0,0" Width="80" Height="104" 
					HorizontalAlignment="Right" VerticalAlignment="Top"
                    Click="NetworkButton_Click">
                <Button.ContextMenu>
                    <ContextMenu Name="cmPC">
                        <MenuItem Name="cmmiPC" Header="Display Product Information" Click="DisplayProductInfo_Click"/>
                    </ContextMenu>
                </Button.ContextMenu>
                <Image Source="pc.bmp"/>
            </Button>
            <Button x:Name="router" 
                    Margin="10,10,0,0" Width="90" Height="136" 
					HorizontalAlignment="Right" VerticalAlignment="Top"
                    Click="NetworkButton_Click">
                <Button.ContextMenu>
                    <ContextMenu Name="cmRouter">
                        <MenuItem Name="cmmiRouter" Header="Display Product Information" Click="DisplayProductInfo_Click"/>
                    </ContextMenu>
                </Button.ContextMenu>
                <Image Source="Router.bmp"/>
            </Button>
        </StackPanel>

        <StackPanel x:Name="spTotals" Orientation="Horizontal" 
			    Margin="0,0,120,148" Width="210" Height="70" 
                VerticalAlignment="Bottom" d:LayoutOverrides="Height" 
                HorizontalAlignment="Right">

            <StackPanel x:Name="spLabels" Orientation="Vertical" 
				Margin="0,0,0,0" Width="100" Height="60">

                <TextBlock x:Name="totalPriceLabel" Margin="0" Width="88" Height="16" Text="Total Price:" HorizontalAlignment="Right" FontWeight="Bold"/>
                <TextBlock x:Name="retailTotalLabel" Margin="0,0,0,0" Width="88" Height="16" Text="Retail:" HorizontalAlignment="Right" FontWeight="Bold"/>
                <TextBlock x:Name="wholesaleTotalLabel" Margin="0,0,0,0" Width="88" Height="16" Text="Wholesale:" HorizontalAlignment="Right" FontWeight="Bold"/>

                <!-- end spLabels -->
            </StackPanel>
            <StackPanel x:Name="spValues" Orientation="Vertical" 
				Margin="10,0,0,0" Width="100" Height="60">

                <TextBlock x:Name="emptyLabel" Margin="0" Width="88" Height="16" Text="" HorizontalAlignment="Right"/>
                <TextBlock x:Name="retailTotal" Margin="0,0,0,0" Width="88" Height="16" Text="" HorizontalAlignment="Right"/>
                <TextBlock x:Name="wholesaleTotal" Margin="0,0,0,0" Width="88" Height="16" Text="" HorizontalAlignment="Right"/>

                <!-- end spLabels -->
            </StackPanel>

            <!-- end sptotal -->
        </StackPanel>

        <StackPanel Name="spDataGrid" Orientation="Vertical" Margin="8,0,0,8" 
                    VerticalAlignment="Bottom" Height="136" >
            <TextBlock Name="tbDataGridName" Text="Product Data " FontWeight="Bold"/>
            <Custom:DataGrid Name="productsDataGrid" AutoGenerateColumns="False" 
                         Margin="0,0,8,8" VerticalAlignment="Bottom" Height="121"
                         RowDetailsVisibilityMode="VisibleWhenSelected" >

                <Custom:DataGrid.RowDetailsTemplate>
                    <DataTemplate>
                       <StackPanel Orientation="Vertical" Margin="5">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Foreground="CadetBlue" FontSize="12" Width="100" TextWrapping="NoWrap" 
                                Text="CostPrice "/>
                                <TextBlock Foreground="Black" FontSize="12" Width="100" TextWrapping="NoWrap" 
                                Text="{Binding CostPrice}"/>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Foreground="CadetBlue" FontSize="12" Width="100" TextWrapping="NoWrap" 
                                Text="Wholesale% "/>
                                <TextBlock Foreground="Black" FontSize="12" Width="100" TextWrapping="NoWrap" 
                                Text="{Binding WholesaleProfitPercentage}"/>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" >
                                <TextBlock Foreground="CadetBlue" FontSize="12" Width="100" TextWrapping="NoWrap" 
                                Text="Retail% "/>
                                <TextBlock Foreground="Black" FontSize="12" Width="100" TextWrapping="NoWrap" 
                                Text="{Binding RetailProfitPercentage}"/>
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </Custom:DataGrid.RowDetailsTemplate>

                <Custom:DataGrid.Columns>
                    <Custom:DataGridTextColumn Binding="{Binding ProductID}" Header="Product Id"/>
                    <Custom:DataGridTextColumn Binding="{Binding RangeName}" Header="RangeName"/>
                    <Custom:DataGridTextColumn Binding="{Binding LaborHours}" Header="Labor Hours"/>
                    <Custom:DataGridTextColumn Binding="{Binding ProductDescription}" Header="Prod Description"/>
                    <Custom:DataGridTextColumn Binding="{Binding Quantity}" Header="Quantity"/>
                    <Custom:DataGridTextColumn Binding="{Binding RetailPrice}" Header="Retail"/>
                    <Custom:DataGridTextColumn Binding="{Binding WholesalePrice}" Header="Wholesale"/>
               </Custom:DataGrid.Columns>
            </Custom:DataGrid>

            <!-- end stackpanel DataGrid-->
        </StackPanel>

    </Grid>


</Window>
